package com.photoeditor.demo.model.sticker;

import android.text.TextUtils;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class StickerUnlockData {

    private List<String> mUnlockFilter = new CopyOnWriteArrayList<>(); //看激励视频解锁的滤镜，当次有效

    private static StickerUnlockData sInstance;

    private StickerUnlockData() {
    }

    public static StickerUnlockData getInstance() {
        if (sInstance == null) {
            synchronized (StickerUnlockData.class) {
                if (sInstance == null) {
                    sInstance = new StickerUnlockData();
                }
            }
        }
        return sInstance;
    }

    public void unlockSticker(String packageName) {
        if (TextUtils.isEmpty(packageName)) {
            return;
        }
        mUnlockFilter.add(packageName);
    }

    public boolean isUnlockSticker(String packageName) {
        return mUnlockFilter.contains(packageName);
    }

    public void clearSticker() {
        mUnlockFilter.clear();
    }
}
